<template>
  <div class="m-25 mt-65">
    <div class="normal-box-mod">
      <div class="normal-box-hd clearfix">
        <div class="normal-box-title">
          <div class="decorate-square"></div>
            <h2>集置点数据统计</h2>
          </div>
      </div>
      <!-- 搜索 -->
      <div class="normal-box-bd">
        <div class="clearfix mb-20">
            <Col span="8">
              <DatePicker v-model="queryData.startTime" format="yyyy-MM-dd" type="date"  placement="bottom-end" placeholder="开始时间" style="width: 200px"></DatePicker>
              &nbsp;-&nbsp;
              <DatePicker v-model="queryData.endTime" format="yyyy-MM-dd" type="date"  placement="bottom-end" placeholder="结束时间" style="width: 200px"></DatePicker>
            </Col>
          <Button type="primary" custom-icon="iconfont icon-chaxun"  size="small" @click="getTableData">查找</Button>
        </div>
      </div>

      <div class="normal-list-page-bd">
        <Table border :loading="list.loading" :columns="list.columns" :data="list.tableData" ></Table>
      </div>

    </div>
  </div>
</template>
<script>
import gcGarbageTotalApi from '@/api/pingHu/gcGarbageTotal.js'
import global from '@/assets/js/global'
import { Message } from 'iview'
export default {
  name: 'gcGarbageTotal',
  data () {
    return {
      // 列表
      list: {
        loading: false,
        selections: [],
        // 列表展示数据
        tableData: [],
        // 表格表头
        columns: [
          /** 开始自动生成 */
          { align: 'center', title: '姓名', key: 'userName', minWidth: 80 },
          { align: 'center', title: '重量', key: 'weight', minWidth: 80 }
        ]
      },
      List: {
        stationList: [],
        companyList: []
      },
      // 页面查询数据
      queryData: {
        startTime: global.time(new Date()),
        endTime: global.time(new Date())
      }
    }
  },
  methods: {
    // 获取列表
    getTableData () {
      const that = this
      that.list.loading = true
      that.queryData.startTime = global.time(that.queryData.startTime)
      that.queryData.endTime = global.time(that.queryData.endTime)
      gcGarbageTotalApi.getList(that.queryData)
        .then(res => {
          that.list.tableData = res.data
          that.list.loading = false
        })
        .catch(error => {
          Message.error(error)
        })
    }
  },

  async created () {
    await setTimeout({}, 1000)
    this.getTableData()
  }
}
</script>
